#include "widget.h"
#include "ui_widget.h"
#include<QDebug>
#include<QDateTime>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    QDateTime oldTime=ui->dateTimeEdit_2->dateTime();
    QDateTime newtime=ui->dateTimeEdit_new->dateTime();
    int day=oldTime.daysTo(newtime);
    int hour=oldTime.secsTo(newtime);
    QString text=QString("现在是爱你持续了")+QString::number(day)+QString("天")+
            QString::number(hour)+QString("小时了");
    ui->label_result->setText(text);
}
